﻿using System.Collections.Generic;
using System.Linq;
using EzDesk.Core.Model;
using EzDesk.DesktopClient.AppModule.ViewContract;
using EzDesk.DesktopClient.MVVMEnhance;

namespace EzDesk.DesktopClient.AppModule.ViewModel
{
    public class AppFunctionTypeViewModel : ViewModelWithSingleContainer<IAppFunctionTypeView>
    {
        public FunctionType FunctionTypeModel { get; set; }

        public List<AppFunctionCategoryViewModel> AppFunctionCategoryViewModelCollection { get; set; }

        public AppFunctionTypeViewModel(FunctionType functionType)
        {
            this.FunctionTypeModel = functionType;
            this.AppFunctionCategoryViewModelCollection =
                AppManagement.Instance.GetFunctionCategory(FunctionTypeModel).Select(
                    fc => new AppFunctionCategoryViewModel(FunctionTypeModel, fc)).ToList();
        }

    }
}